<!DOCTYPE html>
<!-- saved from url=(0033)http://124.223.42.90:5000/happy8/ -->
<html lang="zh"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <title>快乐8号码生成器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            margin-top: 50px;
        }
        #numbers {
            margin-top: 20px;
        }
        .number-set {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 10px;
        }
        .ball {
            display: inline-block;
            width: 40px;
            height: 40px;
            line-height: 40px;
            border-radius: 50%;
            margin: 5px;
            font-weight: bold;
            text-align: center;
        }
        .ball.front {
            background-color: #d9534f; /* 红色 */
            color: #fff; /* 白色字体 */
        }
        .ball.back {
            background-color: #5bc0de; /* 蓝色 */
            color: #fff; /* 白色字体 */
        }
        .probability {
            margin-left: 20px;
            font-size: 14px;
            color: #333;
        }
        .input-set {
            margin-top: 20px;
        }
        .input-ball {
            width: 40px;
            height: 40px;
            text-align: center;
            margin: 5px;
            border: none;
            font-size: 16px;
        }
        .input-ball.front {
            background-color: #f2dede; /* 浅红色 */
            color: #fff; /* 白色字体 */
        }
        .input-ball.back {
            background-color: #d9edf7; /* 浅蓝色 */
            color: #fff; /* 白色字体 */
        }
        input[type=number]::-webkit-outer-spin-button,
        input[type=number]::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        input[type=number] {
            -moz-appearance: textfield;
        }
        button {
            background-color: #d9edf7; /* 浅蓝色 */
            color: #333; /* 深色字体 */
            border: none;
            padding: 10px 20px;
            margin-left: 10px;
            cursor: pointer;
            border-radius: 5px;
        }
    </style>
</head>
<body>
    <h1>快乐8号码生成器</h1>
    <button onclick="generateNumbers()">生成号码</button>
    <div id="numbers"><div class="number-set"><span class="ball front">1</span><span class="probability">幸运度: 4.11%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">10</span><span class="probability">幸运度: 0.19%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">2</span><span class="ball front">14</span><span class="probability">幸运度: 14.88%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">2</span><span class="ball front">4</span><span class="ball front">9</span><span class="probability">幸运度: 9.57%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">6</span><span class="ball front">16</span><span class="ball front">29</span><span class="ball front">32</span><span class="probability">幸运度: 6.55%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">2</span><span class="ball front">3</span><span class="ball front">4</span><span class="ball front">16</span><span class="ball front">17</span><span class="probability">幸运度: 36.41%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">6</span><span class="ball front">7</span><span class="ball front">8</span><span class="ball front">17</span><span class="ball front">20</span><span class="ball front">26</span><span class="probability">幸运度: 1.29%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">13</span><span class="ball front">17</span><span class="ball front">23</span><span class="ball front">26</span><span class="ball front">37</span><span class="ball front">45</span><span class="ball front">47</span><span class="probability">幸运度: 72.25%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">4</span><span class="ball front">33</span><span class="ball front">34</span><span class="ball front">38</span><span class="ball front">69</span><span class="ball front">75</span><span class="ball front">79</span><span class="ball front">80</span><span class="probability">幸运度: 26.81%</span></div><div class="number-set"><span class="ball front">1</span><span class="ball front">8</span><span class="ball front">12</span><span class="ball front">28</span><span class="ball front">53</span><span class="ball front">57</span><span class="ball front">67</span><span class="ball front">68</span><span class="ball front">76</span><span class="ball front">80</span><span class="probability">幸运度: 27.48%</span></div></div>

<!--    <div class="input-set">
        <h2>输入你的号码</h2>
        <div>
            <input type="number" class="input-ball front" id="input1" min="1" max="80" oninput="moveToNext(this, &#39;input2&#39;)">
            <input type="number" class="input-ball front" id="input2" min="1" max="80" oninput="moveToNext(this, &#39;input3&#39;)">
            <input type="number" class="input-ball front" id="input3" min="1" max="80" oninput="moveToNext(this, &#39;input4&#39;)">
            <input type="number" class="input-ball front" id="input4" min="1" max="80" oninput="moveToNext(this, &#39;input5&#39;)">
            <input type="number" class="input-ball front" id="input5" min="1" max="80" oninput="moveToNext(this, &#39;input6&#39;)">
            <input type="number" class="input-ball front" id="input6" min="1" max="80" oninput="moveToNext(this, &#39;input7&#39;)">
            <input type="number" class="input-ball front" id="input7" min="1" max="80" oninput="moveToNext(this, &#39;input8&#39;)">
            <input type="number" class="input-ball front" id="input8" min="1" max="80" oninput="moveToNext(this, &#39;input9&#39;)">
            <input type="number" class="input-ball front" id="input9" min="1" max="80" oninput="moveToNext(this, &#39;input10&#39;)">
            <input type="number" class="input-ball front" id="input10" min="1" max="80">
        </div>
        <button onclick="scoreNumbers()">提交号码</button>
        <div id="score"></div>
    </div> -->

    <script>
        function moveToNext(current, nextFieldID) {
            if (current.value.length >= current.max.length) {
                document.getElementById(nextFieldID).focus();
            }
        }

        function generateNumbers() {
            const numbersDiv = document.getElementById('numbers');
            numbersDiv.innerHTML = '';  // 清空现有号码

            const totalNumbers = 55; // 1+2+3+4+5+6+7+8+9+10
            const randomNumbers = new Set();
            while (randomNumbers.size < totalNumbers) {
                randomNumbers.add(Math.floor(Math.random() * 80) + 1);
            }

            let index = 0;
            for (let row = 1; row <= 10; row++) {
                const numberSetDiv = document.createElement('div');
                numberSetDiv.classList.add('number-set');  // 新增class来让号码和概率在同一行

                for (let col = 0; col < row; col++) {
                    const ball = document.createElement('span');
                    ball.classList.add('ball', 'front');
                    ball.textContent = Array.from(randomNumbers)[index++];
                    numberSetDiv.appendChild(ball);
                }

                numbersDiv.appendChild(numberSetDiv);
            }
        }

        function scoreNumbers() {
            const scoreDiv = document.getElementById('score');
            scoreDiv.textContent = '当前版本不支持评分功能';
        }

        // 页面加载完成后自动调用 generateNumbers 函数
        document.addEventListener('DOMContentLoaded', generateNumbers);
    </script>


</body></html>